// @Date         2021-11-29
// @Author       Aaron Zhang
// @Description
// @FileName      middleware.go

package template

import "zin/framework/util"

var middlewareTmp = `package {{.name}}

import "zin/framework/gin"

// {{.name|title}}Middleware 代表中间件函数
func {{.name|title}}Middleware() gin.HandlerFunc {
	return func(context *gin.Context) {
		context.Next()
	}
}
`

func CreateNewMiddleware(name string, data map[string]interface{}) error {
	return putContentToFileByTemplate(name, name, middlewareTmp, util.GetAppProvider().MiddlewareFolder(), data)
}
